package com.neuedu.carsystem.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.carsystem.dao.CarDao;
import com.neuedu.carsystem.model.Car;
@Repository
public class CarDaoImpl implements CarDao {
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;
	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}
	@Override
	public List<Car> findCarAll(Map<String, Object> map) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).findCarAll(map);
	}

	@Override
	public int addCar(Car u) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).addCar(u);
	}

	@Override
	public int deleteCar(int id) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).deleteCar(id);
	}

	@Override
	public int updateCar(int u) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).updateCar(u);
	}
	@Override
	public int countCar() {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).countCar();
	}
	@Override
	public Car  findById(int id) {
		// TODO Auto-generated method stub
		return sqlSessionTemplate.getMapper(CarDao.class).findById(id);
	}

}
